package com.eazyimage.lab.service;

import com.eazyimage.lab.entity.User;
import com.eazyimage.lab.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.eazyimage.lab.service.SH256Service.getSHA256Str;

@Service
public class LoginService {
    @Autowired
    UserMapper us;
    public User login(String username,String password){
        String expassword = getSHA256Str(password).toString();
        return us.login(username,expassword);
    }
    public int registeronly(String username){
        return us.registeronly(username);
    }

    public void register(String username,String password){
        String expassword = getSHA256Str(password).toString();
        us.register(username,expassword);
    }
}

